        <?php $this->headScript()->appendFile($this->JS_PATH . 'comment.js'); ?>


  <link href="<?php echo $this->CSS_PATH; ?>compiled/user-profile.css" rel="stylesheet" />     
<div id="comment-listing"></div>
        <div class="container-fluid">
            <div class="user-profile" >
                <div class="row-fluid profile">
                    <!-- bio, new note & orders column -->
                    <div class="bio">
                        <div>
                            <!-- Request Data -->
                            <div class="span12 ">
                                <h6><?php echo $this->translate("comt_req_detail"); ?></h6>
                               
                              <table class="table table-hover">
                                <thead>
                                    <tr>
                                        <th class="col-md-3"><?php echo $this->translate("contractor_dash_date"); ?></th>
                                        <th class="col-md-3"><?php echo $this->translate("contractor_dash_ref"); ?></th>
                                        <th class="col-md-3"><?php echo $this->translate("contractor_dash_site"); ?></th>
                                        <th class="col-md-3"><?php echo $this->translate("contractor_dash_subject"); ?></th>
                                        <th class="col-md-3"><?php echo $this->translate("contractor_dash_comment"); ?></th>
                                        <th class="col-md-3"><?php echo $this->translate("contractor_dash_who"); ?></th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td><?php echo $this->requestData['req_date']." ".date('H:i',  strtotime($this->requestData['req_createddate']));?></td>
                                        <td><?php echo $this->requestData['req_reference'];?></td>
                                        <td><?php echo $this->requestData['site_name'];?></td>
                                        <td><?php echo $this->requestData['subj_name'];?></td>
                                        <td><?php echo $this->requestData['req_comment'];?>
                                        <br/><?php if($this->requestData["req_closerequest"] == 1): ?>
                                        <b>Request is been closed and resolution time is : </b>
                                        <?php
                                            $start_date = date('Y-m-d H:i:s',  strtotime($this->requestData['req_createddate']));
                                            $end_date = date('Y-m-d H:i:s',  strtotime($this->requestData['closed_datetime']));
                                            //$start_date = new DateTime($value['req_createddate']);
                                            //$since_start = $start_date->diff($value['closed_datetime']);
                                            $start_date = new DateTime($start_date);
                                            $since_start = $start_date->diff(new DateTime($end_date));

                                            $minutes = $since_start->days * 24 * 60;
                                            $minutes += $since_start->h * 60;
                                            $minutes += $since_start->i;
                                            echo $minutes.' Minutes';
                                            ?>
                                        <?php endif;?>
                                        </td>
                                        <td><?php echo ucfirst($this->requestData['com_name']);?></td>
                                    </tr>
                                </tbody>
                              </table>
                                
                                <br/>
                                <h6><?php echo $this->translate("comt_req_history"); ?></h6>
                                   <table class="table table-hover">
                                <thead>
                                    <tr>
                                        <th class="col-md-3"><?php echo $this->translate("comt_req_dash_date"); ?></th>
                                        <th class="col-md-3"><?php echo $this->translate("comt_req_ass_by"); ?></th>
                                        <th class="col-md-3"><?php echo $this->translate("comt_req_ass_to"); ?></th>
                                        <th class="col-md-3"><?php echo $this->translate("comt_req_status"); ?></th>
                                        
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php if(count($this->requestlogData) > 0):
                                        foreach($this->requestlogData as $key =>$value):
                                        
                                       ?>
                                    <tr>
                                        <td><?php echo date('Y-m-d H:i', strtotime($value['log_createddate']));?></td>
                                        <td><?php 
                                        if( $value['ass_by'] == 1):
                                          echo 'Admin' . " ( ".ucfirst($value['update_adm_firstname']." ".$value['update_adm_lastname'])." )";  
                                        endif;
                                        if( $value['ass_by'] == 2 || $value['ass_by'] == 3):
                                          echo 'Contractor'. " ( ".ucfirst($value['update_cont_firstname']." ".$value['update_cont_lastname'])." )";  
                                        endif;
                                       
                                        
                                        ?></td>
                                        <td>
                                            <?php
                                                echo ucfirst($value['cont_firstname']." ".$value['cont_lastname']);
                                            ?>
                                        </td>
                                        <td>
                                        <?php 
                                        if ($value['ass_type'] == 3): ?>
                                            <span class="label label-success">Done</span>
                                        <?php endif;?>
                                        <?php if ($value['ass_type'] == 4): ?>
                                            <span class="label label-default">Pending</span>
                                        <?php endif;?>
                                        <?php if ($value['ass_type'] == 5): ?>
                                            <span class="label label-add">In Progress</span>
                                        <?php endif;?>
                                        <?php if ($value['ass_type'] == 6): ?>
                                            <span class="label label-important">Assign</span>
                                        <?php endif;?>
                                         <?php if ($value['ass_type'] == 7): ?>
                                            <span class="label label-add">Seen</span>
                                        <?php endif;?>    
                                         </td>
                                    </tr>
                                    <?php  endforeach;
                                    else:?>
                                    <tr><td colspan="4" style="text-align:center">No record found</tr>
                                    <?php endif;?>
                                </tbody>
                              </table>
                              <br/><br/>
                               <?php 
                                 if(count($this->requestcommentData) > 0):?>
                                <?php foreach($this->requestcommentData as $key =>$value):?>
                                    <div class="span12">
                                        <div class="main_comment">
                                        <div class="cmt_left">
                                            <div class="span4">
                                                <h6><?php echo ucfirst($value['Name']);?></h6>
                                            </div>
                                            <div class="span3">
                                                <label class="label label-add cmt_label"><?php echo $value['Addedby'];?></label>
                                            </div>
                                            <div style="clear: both"></div> 
                                                <p><?php echo $value['comment'];?></p>
                                                 <?php if ($value['cmnt_add_attachment'] != ''):?>
                                                <p><a target="_blank" href="<?php echo $this->PUBLIC_PATH . "upload/comment_attachment/".$value['cmnt_add_attachment'];?>">View Attachment</a></p>
                                                <?php endif;?>
                                        </div>
                                        <div class="cmt_right" >
                                            <?php echo date('Y-m-d H:i',  strtotime($value['createDate']));?>    
                                        </div>
                                        </div>
                                    </div>
                                <?php endforeach;?>
                                <?php endif;?>
                            </div>
                        </div>
                    </div>

                 
                </div>
            </div>
        </div>

  